﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Modles.Models;

namespace BilbilDAL
{
    public class DynamicDAL
    {
        /// <summary>
        /// 根据前端发送的用户信息表id查询并返回动态表，按发布时间降序排序
        /// </summary>
        /// <param name="userInfoId"></param>
        /// <returns></returns>
        public List<Dynamic> GetDynamic(int userInfoId)
        {
            using (VideoPlatformDbContext con = new VideoPlatformDbContext())
            {
                var res = con.Dynamics.Where(x => x.UserInfoId == userInfoId).OrderByDescending(x => x.Time).ToList();
                return res;
            }
        }
    }
}
